package heven.holt.library.http.download

import android.net.Uri

typealias DOWNLOAD_ERROR = (Throwable) -> Unit
typealias DOWNLOAD_PROGRESS = (downloadSize: Long, totalLength: Long, progress: Float) -> Unit
typealias DOWNLOAD_SUCCESS = (uri: Uri) -> Unit

fun downloadFileFromUrl(
    url: String,
    block: DownloadController.() -> Unit
): DownloadController {
    val downloadController = FileDownloadBuilder(url).build()
    downloadController.block()
    return downloadController
}